home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / cpu / tms34010 / 34010gfx.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  67KB  |  1,847 lines

  1. #ifndef RECURSIVE_INCLUDE
  2.  
  3. #define LOG_GRAPHICS_OPS        1
  4.  
  5.  
  6. #if LOG_GRAPHICS_OPS
  7. #define LOGGFX(x) logerror x
  8. #else
  9. #define LOGGFX(x)
  10. #endif
  11.  
  12.  
  13. /* Graphics Instructions */
  14.  
  15. static void line(void)
  16. {
  17.     if (!P_FLAG)
  18.     {
  19.         if (state.window_checking != 0 && state.window_checking != 3)
  20.         {
  21.             logerror("LINE XY  %08X - Window Checking Mode %d not supported\n", PC, state.window_checking);
  22.         }
  23.  
  24.         P_FLAG = 1;
  25.         TEMP = (state.op & 0x80) ? 1 : 0;  /* boundary value depends on the algorithm */
  26.         LOGGFX(("%08X:LINE (%d,%d)-(%d,%d)\n", PC, DADDR_X, DADDR_Y, DADDR_X + DYDX_X, DADDR_Y + DYDX_Y));
  27.     }
  28.  
  29.     if (COUNT > 0)
  30.     {
  31.         INT16 x1,y1;
  32.  
  33.         COUNT--;
  34.         if (state.window_checking != 3 ||
  35.             (DADDR_X >= WSTART_X && DADDR_X <= WEND_X &&
  36.              DADDR_Y >= WSTART_Y && DADDR_Y <= WEND_Y))
  37.             WPIXEL(XYTOL(DADDR_XY),COLOR1);
  38.  
  39.         if (SADDR >= TEMP)
  40.         {
  41.             SADDR += DYDX_Y*2 - DYDX_X*2;
  42.             x1 = INC1_X;
  43.             y1 = INC1_Y;
  44.         }
  45.         else
  46.         {
  47.             SADDR += DYDX_Y*2;
  48.             x1 = INC2_X;
  49.             y1 = INC2_Y;
  50.         }
  51.         DADDR_X += x1;
  52.         DADDR_Y += y1;
  53.  
  54.         COUNT_UNKNOWN_CYCLES(2);
  55.         PC -= 0x10;  /* not done yet, check for interrupts and restart instruction */
  56.         return;
  57.     }
  58.     FINISH_PIX_OP;
  59. }
  60.  
  61.  
  62. /*
  63. cases:
  64. * window modes (0,1,2,3)
  65. * boolean/arithmetic ops (16+6)
  66. * transparency (on/off)
  67. * plane masking
  68. * directions (left->right/right->left, top->bottom/bottom->top)
  69. */
  70.  
  71. static int apply_window(int srcbpp, int src_is_linear)
  72. {
  73.     /* apply the window */
  74.     if (state.window_checking == 0)
  75.         return 0;
  76.     else
  77.     {
  78.         int sx = DADDR_X;
  79.         int sy = DADDR_Y;
  80.         int ex = sx + DYDX_X - 1;
  81.         int ey = sy + DYDX_Y - 1;
  82.         int diff, cycles = 3;
  83.  
  84.         if (state.window_checking == 1 || state.window_checking == 2)
  85.             logerror("Window mode %d not supported!\n", state.window_checking);
  86.  
  87.         /* clear the V flag by default */
  88.         CLR_V;
  89.  
  90.         /* clip X */
  91.         diff = WSTART_X - sx;
  92.         if (diff > 0)
  93.         {
  94.             if (src_is_linear)
  95.                 SADDR += diff * srcbpp;
  96.             else
  97.                 SADDR_X += diff;
  98.             sx += diff;
  99.             V_FLAG = 1;
  100.         }
  101.         diff = ex - WEND_X;
  102.         if (diff > 0)
  103.         {
  104.             ex -= diff;
  105.             V_FLAG = 1;
  106.         }
  107.  
  108.         /* clip Y */
  109.         diff = WSTART_Y - sy;
  110.         if (diff > 0)
  111.         {
  112.             if (src_is_linear)
  113.                 SADDR += diff * SPTCH;
  114.             else
  115.                 SADDR_Y += diff;
  116.             sy += diff;
  117.             V_FLAG = 1;
  118.         }
  119.         diff = ey - WEND_Y;
  120.         if (diff > 0)
  121.         {
  122.             ey -= diff;
  123.             V_FLAG = 1;
  124.         }
  125.  
  126.         /* compute cycles */
  127.         if (DYDX_X != ex - sx + 1 || DYDX_Y != ey - sy + 1)
  128.         {
  129.             if (DADDR_X != sx || DADDR_Y != sy)
  130.                 cycles += 11;
  131.             else
  132.                 cycles += 3;
  133.         }
  134.         else if (DADDR_X != sx || DADDR_Y != sy)
  135.             cycles += 7;
  136.  
  137.         /* update the values */
  138.         DADDR_X = sx;
  139.         DADDR_Y = sy;
  140.         DYDX_X = ex - sx + 1;
  141.         DYDX_Y = ey - sy + 1;
  142.         return cycles;
  143.     }
  144. }
  145.  
  146.  
  147. /*******************************************************************
  148.  
  149.     About the timing of gfx operations:
  150.  
  151.     The 34010 manual lists a fairly intricate and accurate way of
  152.     computing cycle timings for graphics ops. However, there are
  153.     enough typos and misleading statements to make the reliability
  154.     of the timing info questionable.
  155.  
  156.     So, to address this, here is a simplified approximate version
  157.     of the timing.
  158.  
  159.         timing = setup + (srcwords * 2 + dstwords * (2 + gfxop)) * rows
  160.  
  161.     Each read/write access takes 2 cycles. Each gfx operation has
  162.     its own timing as specified in the 34010 manual. So, it's 2
  163.     cycles per read plus 2 cycles per write plus gfxop cycles
  164.     per operation. Pretty simple, no?
  165.  
  166. *******************************************************************/
  167.  
  168. int compute_fill_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing)
  169. {
  170.     int dstwords;
  171.  
  172.     if (left_partials) full_words += 1;
  173.     if (right_partials) full_words += 1;
  174.     dstwords = full_words;
  175.  
  176.     return (dstwords * (2 + op_timing)) * rows + 2;
  177. }
  178.  
  179. int compute_pixblt_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing)
  180. {
  181.     int srcwords, dstwords;
  182.  
  183.     if (left_partials) full_words += 1;
  184.     if (right_partials) full_words += 1;
  185.     srcwords = full_words;
  186.     dstwords = full_words;
  187.  
  188.     return (dstwords * (2 + op_timing) + srcwords * 2) * rows + 2;
  189. }
  190.  
  191. int compute_pixblt_b_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing, int bpp)
  192. {
  193.     int srcwords, dstwords;
  194.  
  195.     if (left_partials) full_words += 1;
  196.     if (right_partials) full_words += 1;
  197.     srcwords = full_words * bpp / 16;
  198.     dstwords = full_words;
  199.  
  200.     return (dstwords * (2 + op_timing) + srcwords * 2) * rows + 2;
  201. }
  202.  
  203.  
  204. /* Shift register handling */
  205. static WRITE_HANDLER( shiftreg_w )
  206. {
  207.     if (state.config->from_shiftreg)
  208.         (*state.config->from_shiftreg)((UINT32)(offset << 3) & ~15, &state.shiftreg[0]);
  209.     else
  210.         logerror("From ShiftReg function not set. PC = %08X\n", PC);
  211. }
  212.  
  213. static READ_HANDLER( shiftreg_r )
  214. {
  215.     if (state.config->to_shiftreg)
  216.         (*state.config->to_shiftreg)((UINT32)(offset << 3) & ~15, &state.shiftreg[0]);
  217.     else
  218.         logerror("To ShiftReg function not set. PC = %08X\n", PC);
  219.     return state.shiftreg[0];
  220. }
  221.  
  222. static READ_HANDLER( dummy_shiftreg_r )
  223. {
  224.     return state.shiftreg[0];
  225. }
  226.  
  227.  
  228.  
  229. /* Pixel operations */
  230. static UINT16 pixel_op00(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix; }
  231. static UINT16 pixel_op01(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix & dstpix; }
  232. static UINT16 pixel_op02(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix & ~dstpix; }
  233. static UINT16 pixel_op03(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return 0; }
  234. static UINT16 pixel_op04(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix | ~dstpix) & mask; }
  235. static UINT16 pixel_op05(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix ^ dstpix) & mask; }
  236. static UINT16 pixel_op06(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~dstpix & mask; }
  237. static UINT16 pixel_op07(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix | dstpix) & mask; }
  238. static UINT16 pixel_op08(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix | dstpix) & mask; }
  239. static UINT16 pixel_op09(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return dstpix & mask; }
  240. static UINT16 pixel_op10(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix ^ dstpix) & mask; }
  241. static UINT16 pixel_op11(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (~srcpix & dstpix) & mask; }
  242. static UINT16 pixel_op12(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return mask; }
  243. static UINT16 pixel_op13(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (~srcpix & dstpix) & mask; }
  244. static UINT16 pixel_op14(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return ~(srcpix & dstpix) & mask; }
  245. static UINT16 pixel_op15(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return srcpix ^ mask; }
  246. static UINT16 pixel_op16(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (srcpix + dstpix) & mask; }
  247. static UINT16 pixel_op17(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { INT32 tmp = srcpix + (dstpix & mask); return (tmp > mask) ? mask : tmp; }
  248. static UINT16 pixel_op18(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { return (dstpix - srcpix) & mask; }
  249. static UINT16 pixel_op19(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { INT32 tmp = srcpix - (dstpix & mask); return (tmp < 0) ? 0 : tmp; }
  250. static UINT16 pixel_op20(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { dstpix &= mask; return (srcpix > dstpix) ? srcpix : dstpix; }
  251. static UINT16 pixel_op21(UINT16 dstpix, UINT16 mask, UINT16 srcpix) { dstpix &= mask; return (srcpix < dstpix) ? srcpix : dstpix; }
  252.  
  253. static UINT16 (*pixel_op_table[])(UINT16, UINT16, UINT16) =
  254. {
  255.     pixel_op00,    pixel_op01,    pixel_op02,    pixel_op03,    pixel_op04,    pixel_op05,    pixel_op06,    pixel_op07,
  256.     pixel_op08,    pixel_op09,    pixel_op10,    pixel_op11,    pixel_op12,    pixel_op13,    pixel_op14,    pixel_op15,
  257.     pixel_op16,    pixel_op17,    pixel_op18,    pixel_op19,    pixel_op20,    pixel_op21,    pixel_op00,    pixel_op00,
  258.     pixel_op00,    pixel_op00,    pixel_op00,    pixel_op00,    pixel_op00,    pixel_op00,    pixel_op00,    pixel_op00
  259. };
  260. static UINT8 pixel_op_timing_table[] =
  261. {
  262.     2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,6,5,5,2,2,2,2,2,2,2,2,2,2,2
  263. };
  264. static UINT16 (*pixel_op)(UINT16, UINT16, UINT16);
  265. static UINT32 pixel_op_timing;
  266.  
  267.  
  268. /* Blitters/fillers */
  269. static void pixblt_1_op0(int src_is_linear, int dst_is_linear);
  270. static void pixblt_2_op0(int src_is_linear, int dst_is_linear);
  271. static void pixblt_4_op0(int src_is_linear, int dst_is_linear);
  272. static void pixblt_8_op0(int src_is_linear, int dst_is_linear);
  273. static void pixblt_16_op0(int src_is_linear, int dst_is_linear);
  274. static void pixblt_r_1_op0(int src_is_linear, int dst_is_linear);
  275. static void pixblt_r_2_op0(int src_is_linear, int dst_is_linear);
  276. static void pixblt_r_4_op0(int src_is_linear, int dst_is_linear);
  277. static void pixblt_r_8_op0(int src_is_linear, int dst_is_linear);
  278. static void pixblt_r_16_op0(int src_is_linear, int dst_is_linear);
  279. static void pixblt_b_1_op0(int dst_is_linear);
  280. static void pixblt_b_2_op0(int dst_is_linear);
  281. static void pixblt_b_4_op0(int dst_is_linear);
  282. static void pixblt_b_8_op0(int dst_is_linear);
  283. static void pixblt_b_16_op0(int dst_is_linear);
  284. static void fill_1_op0(int dst_is_linear);
  285. static void fill_2_op0(int dst_is_linear);
  286. static void fill_4_op0(int dst_is_linear);
  287. static void fill_8_op0(int dst_is_linear);
  288. static void fill_16_op0(int dst_is_linear);
  289.  
  290. static void pixblt_1_op0_trans(int src_is_linear, int dst_is_linear);
  291. static void pixblt_2_op0_trans(int src_is_linear, int dst_is_linear);
  292. static void pixblt_4_op0_trans(int src_is_linear, int dst_is_linear);
  293. static void pixblt_8_op0_trans(int src_is_linear, int dst_is_linear);
  294. static void pixblt_16_op0_trans(int src_is_linear, int dst_is_linear);
  295. static void pixblt_r_1_op0_trans(int src_is_linear, int dst_is_linear);
  296. static void pixblt_r_2_op0_trans(int src_is_linear, int dst_is_linear);
  297. static void pixblt_r_4_op0_trans(int src_is_linear, int dst_is_linear);
  298. static void pixblt_r_8_op0_trans(int src_is_linear, int dst_is_linear);
  299. static void pixblt_r_16_op0_trans(int src_is_linear, int dst_is_linear);
  300. static void pixblt_b_1_op0_trans(int dst_is_linear);
  301. static void pixblt_b_2_op0_trans(int dst_is_linear);
  302. static void pixblt_b_4_op0_trans(int dst_is_linear);
  303. static void pixblt_b_8_op0_trans(int dst_is_linear);
  304. static void pixblt_b_16_op0_trans(int dst_is_linear);
  305. static void fill_1_op0_trans(int dst_is_linear);
  306. static void fill_2_op0_trans(int dst_is_linear);
  307. static void fill_4_op0_trans(int dst_is_linear);
  308. static void fill_8_op0_trans(int dst_is_linear);
  309. static void fill_16_op0_trans(int dst_is_linear);
  310.  
  311. static void pixblt_1_opx(int src_is_linear, int dst_is_linear);
  312. static void pixblt_2_opx(int src_is_linear, int dst_is_linear);
  313. static void pixblt_4_opx(int src_is_linear, int dst_is_linear);
  314. static void pixblt_8_opx(int src_is_linear, int dst_is_linear);
  315. static void pixblt_16_opx(int src_is_linear, int dst_is_linear);
  316. static void pixblt_r_1_opx(int src_is_linear, int dst_is_linear);
  317. static void pixblt_r_2_opx(int src_is_linear, int dst_is_linear);
  318. static void pixblt_r_4_opx(int src_is_linear, int dst_is_linear);
  319. static void pixblt_r_8_opx(int src_is_linear, int dst_is_linear);
  320. static void pixblt_r_16_opx(int src_is_linear, int dst_is_linear);
  321. static void pixblt_b_1_opx(int dst_is_linear);
  322. static void pixblt_b_2_opx(int dst_is_linear);
  323. static void pixblt_b_4_opx(int dst_is_linear);
  324. static void pixblt_b_8_opx(int dst_is_linear);
  325. static void pixblt_b_16_opx(int dst_is_linear);
  326. static void fill_1_opx(int dst_is_linear);
  327. static void fill_2_opx(int dst_is_linear);
  328. static void fill_4_opx(int dst_is_linear);
  329. static void fill_8_opx(int dst_is_linear);
  330. static void fill_16_opx(int dst_is_linear);
  331.  
  332. static void pixblt_1_opx_trans(int src_is_linear, int dst_is_linear);
  333. static void pixblt_2_opx_trans(int src_is_linear, int dst_is_linear);
  334. static void pixblt_4_opx_trans(int src_is_linear, int dst_is_linear);
  335. static void pixblt_8_opx_trans(int src_is_linear, int dst_is_linear);
  336. static void pixblt_16_opx_trans(int src_is_linear, int dst_is_linear);
  337. static void pixblt_r_1_opx_trans(int src_is_linear, int dst_is_linear);
  338. static void pixblt_r_2_opx_trans(int src_is_linear, int dst_is_linear);
  339. static void pixblt_r_4_opx_trans(int src_is_linear, int dst_is_linear);
  340. static void pixblt_r_8_opx_trans(int src_is_linear, int dst_is_linear);
  341. static void pixblt_r_16_opx_trans(int src_is_linear, int dst_is_linear);
  342. static void pixblt_b_1_opx_trans(int dst_is_linear);
  343. static void pixblt_b_2_opx_trans(int dst_is_linear);
  344. static void pixblt_b_4_opx_trans(int dst_is_linear);
  345. static void pixblt_b_8_opx_trans(int dst_is_linear);
  346. static void pixblt_b_16_opx_trans(int dst_is_linear);
  347. static void fill_1_opx_trans(int dst_is_linear);
  348. static void fill_2_opx_trans(int dst_is_linear);
  349. static void fill_4_opx_trans(int dst_is_linear);
  350. static void fill_8_opx_trans(int dst_is_linear);
  351. static void fill_16_opx_trans(int dst_is_linear);
  352.  
  353.  
  354. /* tables */
  355. static void (*pixblt_op_table[])(int, int) =
  356. {
  357.     pixblt_1_op0,    pixblt_1_op0_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  358.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  359.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  360.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  361.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  362.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  363.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  364.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  365.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  366.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  367.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  368.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  369.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  370.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  371.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  372.     pixblt_1_opx,    pixblt_1_opx_trans,        pixblt_1_opx,    pixblt_1_opx_trans,
  373.  
  374.     pixblt_2_op0,    pixblt_2_op0_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  375.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  376.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  377.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  378.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  379.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  380.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  381.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  382.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  383.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  384.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  385.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  386.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  387.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  388.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  389.     pixblt_2_opx,    pixblt_2_opx_trans,        pixblt_2_opx,    pixblt_2_opx_trans,
  390.  
  391.     pixblt_4_op0,    pixblt_4_op0_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  392.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  393.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  394.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  395.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  396.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  397.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  398.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  399.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  400.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  401.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  402.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  403.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  404.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  405.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  406.     pixblt_4_opx,    pixblt_4_opx_trans,        pixblt_4_opx,    pixblt_4_opx_trans,
  407.  
  408.     pixblt_8_op0,    pixblt_8_op0_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  409.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  410.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  411.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  412.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  413.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  414.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  415.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  416.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  417.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  418.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  419.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  420.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  421.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  422.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  423.     pixblt_8_opx,    pixblt_8_opx_trans,        pixblt_8_opx,    pixblt_8_opx_trans,
  424.  
  425.     pixblt_16_op0,    pixblt_16_op0_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  426.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  427.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  428.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  429.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  430.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  431.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  432.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  433.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  434.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  435.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  436.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  437.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  438.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  439.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans,
  440.     pixblt_16_opx,    pixblt_16_opx_trans,    pixblt_16_opx,    pixblt_16_opx_trans
  441. };
  442.  
  443. static void (*pixblt_r_op_table[])(int, int) =
  444. {
  445.     pixblt_r_1_op0,    pixblt_r_1_op0_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  446.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  447.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  448.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  449.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  450.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  451.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  452.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  453.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  454.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  455.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  456.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  457.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  458.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  459.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  460.     pixblt_r_1_opx,    pixblt_r_1_opx_trans,    pixblt_r_1_opx,    pixblt_r_1_opx_trans,
  461.  
  462.     pixblt_r_2_op0,    pixblt_r_2_op0_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  463.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  464.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  465.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  466.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  467.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  468.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  469.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  470.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  471.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  472.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  473.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  474.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  475.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  476.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  477.     pixblt_r_2_opx,    pixblt_r_2_opx_trans,    pixblt_r_2_opx,    pixblt_r_2_opx_trans,
  478.  
  479.     pixblt_r_4_op0,    pixblt_r_4_op0_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  480.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  481.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  482.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  483.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  484.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  485.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  486.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  487.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  488.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  489.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  490.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  491.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  492.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  493.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  494.     pixblt_r_4_opx,    pixblt_r_4_opx_trans,    pixblt_r_4_opx,    pixblt_r_4_opx_trans,
  495.  
  496.     pixblt_r_8_op0,    pixblt_r_8_op0_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  497.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  498.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  499.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  500.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  501.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  502.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  503.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  504.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  505.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  506.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  507.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  508.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  509.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  510.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  511.     pixblt_r_8_opx,    pixblt_r_8_opx_trans,    pixblt_r_8_opx,    pixblt_r_8_opx_trans,
  512.  
  513.     pixblt_r_16_op0,pixblt_r_16_op0_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  514.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  515.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  516.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  517.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  518.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  519.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  520.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  521.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  522.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  523.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  524.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  525.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  526.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  527.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans,
  528.     pixblt_r_16_opx,pixblt_r_16_opx_trans,    pixblt_r_16_opx,pixblt_r_16_opx_trans
  529. };
  530.  
  531. static void (*pixblt_b_op_table[])(int) =
  532. {
  533.     pixblt_b_1_op0,    pixblt_b_1_op0_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  534.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  535.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  536.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  537.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  538.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  539.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  540.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  541.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  542.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  543.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  544.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  545.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  546.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  547.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  548.     pixblt_b_1_opx,    pixblt_b_1_opx_trans,    pixblt_b_1_opx,    pixblt_b_1_opx_trans,
  549.  
  550.     pixblt_b_2_op0,    pixblt_b_2_op0_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  551.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  552.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  553.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  554.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  555.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  556.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  557.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  558.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  559.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  560.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  561.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  562.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  563.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  564.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  565.     pixblt_b_2_opx,    pixblt_b_2_opx_trans,    pixblt_b_2_opx,    pixblt_b_2_opx_trans,
  566.  
  567.     pixblt_b_4_op0,    pixblt_b_4_op0_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  568.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  569.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  570.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  571.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  572.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  573.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  574.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  575.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  576.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  577.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  578.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  579.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  580.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  581.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  582.     pixblt_b_4_opx,    pixblt_b_4_opx_trans,    pixblt_b_4_opx,    pixblt_b_4_opx_trans,
  583.  
  584.     pixblt_b_8_op0,    pixblt_b_8_op0_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  585.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  586.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  587.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  588.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  589.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  590.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  591.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  592.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  593.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  594.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  595.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  596.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  597.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  598.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  599.     pixblt_b_8_opx,    pixblt_b_8_opx_trans,    pixblt_b_8_opx,    pixblt_b_8_opx_trans,
  600.  
  601.     pixblt_b_16_op0,pixblt_b_16_op0_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  602.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  603.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  604.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  605.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  606.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  607.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  608.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  609.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  610.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  611.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  612.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  613.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  614.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  615.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans,
  616.     pixblt_b_16_opx,pixblt_b_16_opx_trans,    pixblt_b_16_opx,pixblt_b_16_opx_trans
  617. };
  618.  
  619. static void (*fill_op_table[])(int) =
  620. {
  621.     fill_1_op0,        fill_1_op0_trans,        fill_1_opx,        fill_1_opx_trans,
  622.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  623.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  624.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  625.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  626.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  627.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  628.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  629.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  630.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  631.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  632.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  633.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  634.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  635.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  636.     fill_1_opx,        fill_1_opx_trans,        fill_1_opx,        fill_1_opx_trans,
  637.  
  638.     fill_2_op0,        fill_2_op0_trans,        fill_2_opx,        fill_2_opx_trans,
  639.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  640.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  641.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  642.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  643.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  644.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  645.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  646.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  647.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  648.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  649.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  650.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  651.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  652.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  653.     fill_2_opx,        fill_2_opx_trans,        fill_2_opx,        fill_2_opx_trans,
  654.  
  655.     fill_4_op0,        fill_4_op0_trans,        fill_4_opx,        fill_4_opx_trans,
  656.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  657.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  658.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  659.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  660.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  661.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  662.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  663.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  664.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  665.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  666.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  667.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  668.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  669.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  670.     fill_4_opx,        fill_4_opx_trans,        fill_4_opx,        fill_4_opx_trans,
  671.  
  672.     fill_8_op0,        fill_8_op0_trans,        fill_8_opx,        fill_8_opx_trans,
  673.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  674.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  675.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  676.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  677.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  678.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  679.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  680.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  681.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  682.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  683.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  684.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  685.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  686.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  687.     fill_8_opx,        fill_8_opx_trans,        fill_8_opx,        fill_8_opx_trans,
  688.  
  689.     fill_16_op0,    fill_16_op0_trans,        fill_16_opx,    fill_16_opx_trans,
  690.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  691.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  692.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  693.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  694.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  695.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  696.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  697.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  698.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  699.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  700.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  701.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  702.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  703.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans,
  704.     fill_16_opx,    fill_16_opx_trans,        fill_16_opx,    fill_16_opx_trans
  705. };
  706.  
  707.  
  708. #define RECURSIVE_INCLUDE
  709.  
  710. /* non-transparent replace ops */
  711. #define PIXEL_OP(src, mask, pixel)         pixel = pixel
  712. #define PIXEL_OP_TIMING                     2
  713. #define PIXEL_OP_REQUIRES_SOURCE         0
  714. #define TRANSPARENCY                    0
  715.  
  716.     /* 1bpp cases */
  717.     #define BITS_PER_PIXEL                    1
  718.     #define FUNCTION_NAME(base)                base##_1_op0
  719.     #include "34010gfx.c"
  720.     #undef FUNCTION_NAME
  721.     #undef BITS_PER_PIXEL
  722.  
  723.     /* 2bpp cases */
  724.     #define BITS_PER_PIXEL                    2
  725.     #define FUNCTION_NAME(base)                base##_2_op0
  726.     #include "34010gfx.c"
  727.     #undef FUNCTION_NAME
  728.     #undef BITS_PER_PIXEL
  729.  
  730.     /* 4bpp cases */
  731.     #define BITS_PER_PIXEL                    4
  732.     #define FUNCTION_NAME(base)                base##_4_op0
  733.     #include "34010gfx.c"
  734.     #undef FUNCTION_NAME
  735.     #undef BITS_PER_PIXEL
  736.  
  737.     /* 8bpp cases */
  738.     #define BITS_PER_PIXEL                    8
  739.     #define FUNCTION_NAME(base)                base##_8_op0
  740.     #include "34010gfx.c"
  741.     #undef FUNCTION_NAME
  742.     #undef BITS_PER_PIXEL
  743.  
  744.     /* 16bpp cases */
  745.     #define BITS_PER_PIXEL                    16
  746.     #define FUNCTION_NAME(base)                base##_16_op0
  747.     #include "34010gfx.c"
  748.     #undef FUNCTION_NAME
  749.     #undef BITS_PER_PIXEL
  750.  
  751. #undef TRANSPARENCY
  752. #undef PIXEL_OP_REQUIRES_SOURCE
  753. #undef PIXEL_OP_TIMING
  754. #undef PIXEL_OP
  755.  
  756.  
  757. #define PIXEL_OP(src, mask, pixel)         pixel = (*pixel_op)(src, mask, pixel)
  758. #define PIXEL_OP_TIMING                     pixel_op_timing
  759. #define PIXEL_OP_REQUIRES_SOURCE         1
  760. #define TRANSPARENCY                    0
  761.  
  762.     /* 1bpp cases */
  763.     #define BITS_PER_PIXEL                    1
  764.     #define FUNCTION_NAME(base)                base##_1_opx
  765.     #include "34010gfx.c"
  766.     #undef FUNCTION_NAME
  767.     #undef BITS_PER_PIXEL
  768.  
  769.     /* 2bpp cases */
  770.     #define BITS_PER_PIXEL                    2
  771.     #define FUNCTION_NAME(base)                base##_2_opx
  772.     #include "34010gfx.c"
  773.     #undef FUNCTION_NAME
  774.     #undef BITS_PER_PIXEL
  775.  
  776.     /* 4bpp cases */
  777.     #define BITS_PER_PIXEL                    4
  778.     #define FUNCTION_NAME(base)                base##_4_opx
  779.     #include "34010gfx.c"
  780.     #undef FUNCTION_NAME
  781.     #undef BITS_PER_PIXEL
  782.  
  783.     /* 8bpp cases */
  784.     #define BITS_PER_PIXEL                    8
  785.     #define FUNCTION_NAME(base)                base##_8_opx
  786.     #include "34010gfx.c"
  787.     #undef FUNCTION_NAME
  788.     #undef BITS_PER_PIXEL
  789.  
  790.     /* 16bpp cases */
  791.     #define BITS_PER_PIXEL                    16
  792.     #define FUNCTION_NAME(base)                base##_16_opx
  793.     #include "34010gfx.c"
  794.     #undef FUNCTION_NAME
  795.     #undef BITS_PER_PIXEL
  796.  
  797. #undef TRANSPARENCY
  798. #undef PIXEL_OP_REQUIRES_SOURCE
  799. #undef PIXEL_OP_TIMING
  800. #undef PIXEL_OP
  801.  
  802.  
  803. /* transparent replace ops */
  804. #define PIXEL_OP(src, mask, pixel)         pixel = pixel
  805. #define PIXEL_OP_REQUIRES_SOURCE         0
  806. #define PIXEL_OP_TIMING                     4
  807. #define TRANSPARENCY                    1
  808.  
  809.     /* 1bpp cases */
  810.     #define BITS_PER_PIXEL                    1
  811.     #define FUNCTION_NAME(base)                base##_1_op0_trans
  812.     #include "34010gfx.c"
  813.     #undef FUNCTION_NAME
  814.     #undef BITS_PER_PIXEL
  815.  
  816.     /* 2bpp cases */
  817.     #define BITS_PER_PIXEL                    2
  818.     #define FUNCTION_NAME(base)                base##_2_op0_trans
  819.     #include "34010gfx.c"
  820.     #undef FUNCTION_NAME
  821.     #undef BITS_PER_PIXEL
  822.  
  823.     /* 4bpp cases */
  824.     #define BITS_PER_PIXEL                    4
  825.     #define FUNCTION_NAME(base)                base##_4_op0_trans
  826.     #include "34010gfx.c"
  827.     #undef FUNCTION_NAME
  828.     #undef BITS_PER_PIXEL
  829.  
  830.     /* 8bpp cases */
  831.     #define BITS_PER_PIXEL                    8
  832.     #define FUNCTION_NAME(base)                base##_8_op0_trans
  833.     #include "34010gfx.c"
  834.     #undef FUNCTION_NAME
  835.     #undef BITS_PER_PIXEL
  836.  
  837.     /* 16bpp cases */
  838.     #define BITS_PER_PIXEL                    16
  839.     #define FUNCTION_NAME(base)                base##_16_op0_trans
  840.     #include "34010gfx.c"
  841.     #undef FUNCTION_NAME
  842.     #undef BITS_PER_PIXEL
  843.  
  844. #undef TRANSPARENCY
  845. #undef PIXEL_OP_REQUIRES_SOURCE
  846. #undef PIXEL_OP_TIMING
  847. #undef PIXEL_OP
  848.  
  849.  
  850. #define PIXEL_OP(src, mask, pixel)         pixel = (*pixel_op)(src, mask, pixel)
  851. #define PIXEL_OP_REQUIRES_SOURCE         1
  852. #define PIXEL_OP_TIMING                    (2+pixel_op_timing)
  853. #define TRANSPARENCY                    1
  854.  
  855.     /* 1bpp cases */
  856.     #define BITS_PER_PIXEL                    1
  857.     #define FUNCTION_NAME(base)                base##_1_opx_trans
  858.     #include "34010gfx.c"
  859.     #undef FUNCTION_NAME
  860.     #undef BITS_PER_PIXEL
  861.  
  862.     /* 2bpp cases */
  863.     #define BITS_PER_PIXEL                    2
  864.     #define FUNCTION_NAME(base)                base##_2_opx_trans
  865.     #include "34010gfx.c"
  866.     #undef FUNCTION_NAME
  867.     #undef BITS_PER_PIXEL
  868.  
  869.     /* 4bpp cases */
  870.     #define BITS_PER_PIXEL                    4
  871.     #define FUNCTION_NAME(base)                base##_4_opx_trans
  872.     #include "34010gfx.c"
  873.     #undef FUNCTION_NAME
  874.     #undef BITS_PER_PIXEL
  875.  
  876.     /* 8bpp cases */
  877.     #define BITS_PER_PIXEL                    8
  878.     #define FUNCTION_NAME(base)                base##_8_opx_trans
  879.     #include "34010gfx.c"
  880.     #undef FUNCTION_NAME
  881.     #undef BITS_PER_PIXEL
  882.  
  883.     /* 16bpp cases */
  884.     #define BITS_PER_PIXEL                    16
  885.     #define FUNCTION_NAME(base)                base##_16_opx_trans
  886.     #include "34010gfx.c"
  887.     #undef FUNCTION_NAME
  888.     #undef BITS_PER_PIXEL
  889.  
  890. #undef TRANSPARENCY
  891. #undef PIXEL_OP_REQUIRES_SOURCE
  892. #undef PIXEL_OP_TIMING
  893. #undef PIXEL_OP
  894.  
  895. static UINT8 pixelsize_lookup[32] =
  896. {
  897.     0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
  898. };
  899.  
  900.  
  901. static void pixblt_b_l(void)
  902. {
  903.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  904.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  905.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  906.     int ix = trans | (rop << 1) | (psize << 6);
  907.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT B,L (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  908.     pixel_op = pixel_op_table[rop];
  909.     pixel_op_timing = pixel_op_timing_table[rop];
  910.     (*pixblt_b_op_table[ix])(1);
  911. }
  912.  
  913. static void pixblt_b_xy(void)
  914. {
  915.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  916.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  917.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  918.     int ix = trans | (rop << 1) | (psize << 6);
  919.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT B,XY (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  920.     pixel_op = pixel_op_table[rop];
  921.     pixel_op_timing = pixel_op_timing_table[rop];
  922.     (*pixblt_b_op_table[ix])(0);
  923. }
  924.  
  925. static void pixblt_l_l(void)
  926. {
  927.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  928.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  929.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  930.     int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
  931.     int ix = trans | (rop << 1) | (psize << 6);
  932.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT L,L (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  933.     pixel_op = pixel_op_table[rop];
  934.     pixel_op_timing = pixel_op_timing_table[rop];
  935.     if (!pbh)
  936.         (*pixblt_op_table[ix])(1, 1);
  937.     else
  938.         (*pixblt_r_op_table[ix])(1, 1);
  939. }
  940.  
  941. static void pixblt_l_xy(void)
  942. {
  943.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  944.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  945.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  946.     int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
  947.     int ix = trans | (rop << 1) | (psize << 6);
  948.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT L,XY (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  949.     pixel_op = pixel_op_table[rop];
  950.     pixel_op_timing = pixel_op_timing_table[rop];
  951.     if (!pbh)
  952.         (*pixblt_op_table[ix])(1, 0);
  953.     else
  954.         (*pixblt_r_op_table[ix])(1, 0);
  955. }
  956.  
  957. static void pixblt_xy_l(void)
  958. {
  959.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  960.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  961.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  962.     int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
  963.     int ix = trans | (rop << 1) | (psize << 6);
  964.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT XY,L (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  965.     pixel_op = pixel_op_table[rop];
  966.     pixel_op_timing = pixel_op_timing_table[rop];
  967.     if (!pbh)
  968.         (*pixblt_op_table[ix])(0, 1);
  969.     else
  970.         (*pixblt_r_op_table[ix])(0, 1);
  971. }
  972.  
  973. static void pixblt_xy_xy(void)
  974. {
  975.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  976.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  977.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  978.     int pbh = (IOREG(REG_CONTROL) >> 8) & 1;
  979.     int ix = trans | (rop << 1) | (psize << 6);
  980.     if (!P_FLAG) LOGGFX(("%08X:PIXBLT XY,XY (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  981.     pixel_op = pixel_op_table[rop];
  982.     pixel_op_timing = pixel_op_timing_table[rop];
  983.     if (!pbh)
  984.         (*pixblt_op_table[ix])(0, 0);
  985.     else
  986.         (*pixblt_r_op_table[ix])(0, 0);
  987. }
  988.  
  989. static void fill_l(void)
  990. {
  991.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  992.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  993.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  994.     int ix = trans | (rop << 1) | (psize << 6);
  995.     if (!P_FLAG) LOGGFX(("%08X:FILL L (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  996.     pixel_op = pixel_op_table[rop];
  997.     pixel_op_timing = pixel_op_timing_table[rop];
  998.     (*fill_op_table[ix])(1);
  999. }
  1000.  
  1001. static void fill_xy(void)
  1002. {
  1003.     int psize = pixelsize_lookup[IOREG(REG_PSIZE) & 0x1f];
  1004.     int trans = (IOREG(REG_CONTROL) & 0x20) >> 5;
  1005.     int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f;
  1006.     int ix = trans | (rop << 1) | (psize << 6);
  1007.     if (!P_FLAG) LOGGFX(("%08X:FILL XY (%dx%d)\n", PC, DYDX_X, DYDX_Y));
  1008.     pixel_op = pixel_op_table[rop];
  1009.     pixel_op_timing = pixel_op_timing_table[rop];
  1010.     (*fill_op_table[ix])(0);
  1011. }
  1012.  
  1013.  
  1014. #else
  1015.  
  1016.  
  1017. #undef PIXELS_PER_WORD
  1018. #undef PIXEL_MASK
  1019.  
  1020. #define PIXELS_PER_WORD (16 / BITS_PER_PIXEL)
  1021. #define PIXEL_MASK ((1 << BITS_PER_PIXEL) - 1)
  1022.  
  1023. #ifdef macintosh
  1024. #pragma optimization_level 1
  1025. #endif
  1026.  
  1027. static void FUNCTION_NAME(pixblt)(int src_is_linear, int dst_is_linear)
  1028. {
  1029.     /* if this is the first time through, perform the operation */
  1030.     if (!P_FLAG)
  1031.     {
  1032.         int dx, dy, x, y, words, left_partials, right_partials, full_words, bitshift, bitshift_alt, yreverse;
  1033.         mem_write_handler word_write;
  1034.         mem_read_handler word_read;
  1035.         UINT32 saddr, daddr;
  1036.  
  1037.         /* determine read/write functions */
  1038.         if (IOREG(REG_DPYCTL) & 0x0800)
  1039.         {
  1040.             word_write = shiftreg_w;
  1041.             word_read = shiftreg_r;
  1042.         }
  1043.         else
  1044.         {
  1045.             word_write = cpu_writemem29_word;
  1046.             word_read = cpu_readmem29_word;
  1047.         }
  1048.  
  1049.         /* apply the window for non-linear destinations */
  1050.         BREG(13<<4) = 7 + (src_is_linear ? 0 : 2);
  1051.         if (!dst_is_linear)
  1052.             BREG(13<<4) += 2 + (!src_is_linear) + apply_window(BITS_PER_PIXEL, src_is_linear);
  1053.  
  1054.         /* compute the bounds of the operation */
  1055.         dx = (INT16)DYDX_X;
  1056.         dy = (INT16)DYDX_Y;
  1057.  
  1058.         /* compute the starting addresses */
  1059.         saddr = src_is_linear ? SADDR : XYTOL(SADDR_XY);
  1060.         daddr = dst_is_linear ? DADDR : XYTOL(DADDR_XY);
  1061.         saddr &= ~(BITS_PER_PIXEL - 1);
  1062.         daddr &= ~(BITS_PER_PIXEL - 1);
  1063.  
  1064.         /* bail if we're clipped */
  1065.         if (dx <= 0 || dy <= 0)
  1066.             return;
  1067.  
  1068.         /* handle flipping the addresses */
  1069.         yreverse = (IOREG(REG_CONTROL) >> 9) & 1;
  1070.         if (!src_is_linear || !dst_is_linear)
  1071.             if (yreverse)
  1072.             {
  1073.                 saddr += (dy - 1) * SPTCH;
  1074.                 daddr += (dy - 1) * DPTCH;
  1075.             }
  1076.  
  1077.         /* determine the bit shift to get from source to dest */
  1078.         bitshift = ((daddr & 15) - (saddr & 15)) & 15;
  1079.         bitshift_alt = (16 - bitshift) & 15;
  1080.  
  1081.         /* how many left and right partial pixels do we have? */
  1082.         left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
  1083.         right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
  1084.         full_words = dx - left_partials - right_partials;
  1085.         if (full_words < 0)
  1086.             left_partials = dx, right_partials = full_words = 0;
  1087.         else
  1088.             full_words /= PIXELS_PER_WORD;
  1089.  
  1090.         /* compute cycles */
  1091.         BREG(13<<4) += compute_pixblt_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING);
  1092.         P_FLAG = 1;
  1093.  
  1094.         /* loop over rows */
  1095.         for (y = 0; y < dy; y++)
  1096.         {
  1097.             UINT16 srcword, srcmask, dstword, dstmask, pixel;
  1098.             UINT32 swordaddr, dwordaddr;
  1099.  
  1100.             /* use word addresses each row */
  1101.             swordaddr = saddr >> 4;
  1102.             dwordaddr = daddr >> 4;
  1103.  
  1104.             /* fetch the initial source word */
  1105.             srcword = (*word_read)(swordaddr++ << 1);
  1106.             srcmask = PIXEL_MASK << (saddr & 15);
  1107.  
  1108.             /* handle the left partial word */
  1109.             if (left_partials != 0)
  1110.             {
  1111.                 /* fetch the destination word */
  1112.                 dstword = (*word_read)(dwordaddr << 1);
  1113.                 dstmask = PIXEL_MASK << (daddr & 15);
  1114.  
  1115.                 /* loop over partials */
  1116.                 for (x = 0; x < left_partials; x++)
  1117.                 {
  1118.                     /* process the pixel */
  1119.                     pixel = srcword & srcmask;
  1120.                     if (dstmask > srcmask)
  1121.                         pixel <<= bitshift;
  1122.                     else
  1123.                         pixel >>= bitshift_alt;
  1124.                     PIXEL_OP(dstword, dstmask, pixel);
  1125.                     if (!TRANSPARENCY || pixel != 0)
  1126.                         dstword = (dstword & ~dstmask) | pixel;
  1127.  
  1128.                     /* update the source */
  1129.                     srcmask <<= BITS_PER_PIXEL;
  1130.                     if (srcmask == 0)
  1131.                     {
  1132.                         srcword = (*word_read)(swordaddr++ << 1);
  1133.                         srcmask = PIXEL_MASK;
  1134.                     }
  1135.  
  1136.                     /* update the destination */
  1137.                     dstmask <<= BITS_PER_PIXEL;
  1138.                 }
  1139.  
  1140.                 /* write the result */
  1141.                 (*word_write)(dwordaddr++ << 1, dstword);
  1142.             }
  1143.  
  1144.             /* loop over full words */
  1145.             for (words = 0; words < full_words; words++)
  1146.             {
  1147.                 /* fetch the destination word (if necessary) */
  1148.                 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
  1149.                     dstword = (*word_read)(dwordaddr << 1);
  1150.                 else
  1151.                     dstword = 0;
  1152.                 dstmask = PIXEL_MASK;
  1153.  
  1154.                 /* loop over partials */
  1155.                 for (x = 0; x < PIXELS_PER_WORD; x++)
  1156.                 {
  1157.                     /* process the pixel */
  1158.                     pixel = srcword & srcmask;
  1159.                     if (dstmask > srcmask)
  1160.                         pixel <<= bitshift;
  1161.                     else
  1162.                         pixel >>= bitshift_alt;
  1163.                     PIXEL_OP(dstword, dstmask, pixel);
  1164.                     if (!TRANSPARENCY || pixel != 0)
  1165.                         dstword = (dstword & ~dstmask) | pixel;
  1166.  
  1167.                     /* update the source */
  1168.                     srcmask <<= BITS_PER_PIXEL;
  1169.                     if (srcmask == 0)
  1170.                     {
  1171.                         srcword = (*word_read)(swordaddr++ << 1);
  1172.                         srcmask = PIXEL_MASK;
  1173.                     }
  1174.  
  1175.                     /* update the destination */
  1176.                     dstmask <<= BITS_PER_PIXEL;
  1177.                 }
  1178.  
  1179.                 /* write the result */
  1180.                 (*word_write)(dwordaddr++ << 1, dstword);
  1181.             }
  1182.  
  1183.             /* handle the right partial word */
  1184.             if (right_partials != 0)
  1185.             {
  1186.                 /* fetch the destination word */
  1187.                 dstword = (*word_read)(dwordaddr << 1);
  1188.                 dstmask = PIXEL_MASK;
  1189.  
  1190.                 /* loop over partials */
  1191.                 for (x = 0; x < right_partials; x++)
  1192.                 {
  1193.                     /* process the pixel */
  1194.                     pixel = srcword & srcmask;
  1195.                     if (dstmask > srcmask)
  1196.                         pixel <<= bitshift;
  1197.                     else
  1198.                         pixel >>= bitshift_alt;
  1199.                     PIXEL_OP(dstword, dstmask, pixel);
  1200.                     if (!TRANSPARENCY || pixel != 0)
  1201.                         dstword = (dstword & ~dstmask) | pixel;
  1202.  
  1203.                     /* update the source */
  1204.                     srcmask <<= BITS_PER_PIXEL;
  1205.                     if (srcmask == 0)
  1206.                     {
  1207.                         srcword = (*word_read)(swordaddr++ << 1);
  1208.                         srcmask = PIXEL_MASK;
  1209.                     }
  1210.  
  1211.                     /* update the destination */
  1212.                     dstmask <<= BITS_PER_PIXEL;
  1213.                 }
  1214.  
  1215.                 /* write the result */
  1216.                 (*word_write)(dwordaddr++ << 1, dstword);
  1217.             }
  1218.  
  1219.             /* update for next row */
  1220.             if (!yreverse)
  1221.             {
  1222.                 saddr += SPTCH;
  1223.                 daddr += DPTCH;
  1224.             }
  1225.             else
  1226.             {
  1227.                 saddr -= SPTCH;
  1228.                 daddr -= DPTCH;
  1229.             }
  1230.         }
  1231.     }
  1232.  
  1233.     /* eat cycles */
  1234.     if (BREG(13<<4) > tms34010_ICount)
  1235.     {
  1236.         BREG(13<<4) -= tms34010_ICount;
  1237.         tms34010_ICount = 0;
  1238.         PC -= 0x10;
  1239.     }
  1240.     else
  1241.     {
  1242.         tms34010_ICount -= BREG(13<<4);
  1243.         P_FLAG = 0;
  1244.         if (src_is_linear)
  1245.             SADDR += DYDX_Y * SPTCH + DYDX_X * BITS_PER_PIXEL;
  1246.         else
  1247.             SADDR_Y += DYDX_Y, SADDR_X += DYDX_X;
  1248.         if (dst_is_linear)
  1249.             DADDR += DYDX_Y * DPTCH + DYDX_X * BITS_PER_PIXEL;
  1250.         else
  1251.             DADDR_Y += DYDX_Y, DADDR_X += DYDX_X;
  1252.     }
  1253. }
  1254.  
  1255. static void FUNCTION_NAME(pixblt_r)(int src_is_linear, int dst_is_linear)
  1256. {
  1257.     /* if this is the first time through, perform the operation */
  1258.     if (!P_FLAG)
  1259.     {
  1260.         int dx, dy, x, y, words, left_partials, right_partials, full_words, bitshift, bitshift_alt, yreverse;
  1261.         mem_write_handler word_write;
  1262.         mem_read_handler word_read;
  1263.         UINT32 saddr, daddr;
  1264.  
  1265.         /* determine read/write functions */
  1266.         if (IOREG(REG_DPYCTL) & 0x0800)
  1267.         {
  1268.             word_write = shiftreg_w;
  1269.             word_read = shiftreg_r;
  1270.         }
  1271.         else
  1272.         {
  1273.             word_write = cpu_writemem29_word;
  1274.             word_read = cpu_readmem29_word;
  1275.         }
  1276.  
  1277.         /* apply the window for non-linear destinations */
  1278.         BREG(13<<4) = 7 + (src_is_linear ? 0 : 2);
  1279.         if (!dst_is_linear)
  1280.             BREG(13<<4) += 2 + (!src_is_linear) + apply_window(BITS_PER_PIXEL, src_is_linear);
  1281.  
  1282.         /* compute the bounds of the operation */
  1283.         dx = (INT16)DYDX_X;
  1284.         dy = (INT16)DYDX_Y;
  1285.  
  1286.         /* compute the starting addresses */
  1287.         saddr = src_is_linear ? SADDR : XYTOL(SADDR_XY);
  1288.         daddr = dst_is_linear ? DADDR : XYTOL(DADDR_XY);
  1289.         saddr &= ~(BITS_PER_PIXEL - 1);
  1290.         daddr &= ~(BITS_PER_PIXEL - 1);
  1291.  
  1292.         /* bail if we're clipped */
  1293.         if (dx <= 0 || dy <= 0)
  1294.             return;
  1295.  
  1296.         /* handle flipping the addresses */
  1297.         yreverse = (IOREG(REG_CONTROL) >> 9) & 1;
  1298.         if (!src_is_linear || !dst_is_linear)
  1299.         {
  1300.             saddr += dx * BITS_PER_PIXEL;
  1301.             daddr += dx * BITS_PER_PIXEL;
  1302.             if (yreverse)
  1303.             {
  1304.                 saddr += (dy - 1) * SPTCH;
  1305.                 daddr += (dy - 1) * DPTCH;
  1306.             }
  1307.         }
  1308.  
  1309.         /* determine the bit shift to get from source to dest */
  1310.         bitshift = ((daddr & 15) - (saddr & 15)) & 15;
  1311.         bitshift_alt = (16 - bitshift) & 15;
  1312.  
  1313.         /* how many left and right partial pixels do we have? */
  1314.         left_partials = (PIXELS_PER_WORD - (((daddr - dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
  1315.         right_partials = (daddr & 15) / BITS_PER_PIXEL;
  1316.         full_words = dx - left_partials - right_partials;
  1317.         if (full_words < 0)
  1318.             left_partials = dx, right_partials = full_words = 0;
  1319.         else
  1320.             full_words /= PIXELS_PER_WORD;
  1321.  
  1322.         /* compute cycles */
  1323.         BREG(13<<4) += compute_pixblt_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING);
  1324.         P_FLAG = 1;
  1325.  
  1326.         /* loop over rows */
  1327.         for (y = 0; y < dy; y++)
  1328.         {
  1329.             UINT16 srcword, srcmask, dstword, dstmask, pixel;
  1330.             UINT32 swordaddr, dwordaddr;
  1331.  
  1332.             /* use word addresses each row */
  1333.             swordaddr = (saddr + 15) >> 4;
  1334.             dwordaddr = (daddr + 15) >> 4;
  1335.  
  1336.             /* fetch the initial source word */
  1337.             srcword = (*word_read)(--swordaddr << 1);
  1338.             srcmask = PIXEL_MASK << ((saddr - BITS_PER_PIXEL) & 15);
  1339.  
  1340.             /* handle the right partial word */
  1341.             if (right_partials != 0)
  1342.             {
  1343.                 /* fetch the destination word */
  1344.                 dstword = (*word_read)(--dwordaddr << 1);
  1345.                 dstmask = PIXEL_MASK << ((daddr - BITS_PER_PIXEL) & 15);
  1346.  
  1347.                 /* loop over partials */
  1348.                 for (x = 0; x < right_partials; x++)
  1349.                 {
  1350.                     /* process the pixel */
  1351.                     pixel = srcword & srcmask;
  1352.                     if (dstmask > srcmask)
  1353.                         pixel <<= bitshift;
  1354.                     else
  1355.                         pixel >>= bitshift_alt;
  1356.                     PIXEL_OP(dstword, dstmask, pixel);
  1357.                     if (!TRANSPARENCY || pixel != 0)
  1358.                         dstword = (dstword & ~dstmask) | pixel;
  1359.  
  1360.                     /* update the source */
  1361.                     srcmask >>= BITS_PER_PIXEL;
  1362.                     if (srcmask == 0)
  1363.                     {
  1364.                         srcword = (*word_read)(--swordaddr << 1);
  1365.                         srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
  1366.                     }
  1367.  
  1368.                     /* update the destination */
  1369.                     dstmask >>= BITS_PER_PIXEL;
  1370.                 }
  1371.  
  1372.                 /* write the result */
  1373.                 (*word_write)(dwordaddr << 1, dstword);
  1374.             }
  1375.  
  1376.             /* loop over full words */
  1377.             for (words = 0; words < full_words; words++)
  1378.             {
  1379.                 /* fetch the destination word (if necessary) */
  1380.                 dwordaddr--;
  1381.                 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
  1382.                     dstword = (*word_read)(dwordaddr << 1);
  1383.                 else
  1384.                     dstword = 0;
  1385.                 dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
  1386.  
  1387.                 /* loop over partials */
  1388.                 for (x = 0; x < PIXELS_PER_WORD; x++)
  1389.                 {
  1390.                     /* process the pixel */
  1391.                     pixel = srcword & srcmask;
  1392.                     if (dstmask > srcmask)
  1393.                         pixel <<= bitshift;
  1394.                     else
  1395.                         pixel >>= bitshift_alt;
  1396.                     PIXEL_OP(dstword, dstmask, pixel);
  1397.                     if (!TRANSPARENCY || pixel != 0)
  1398.                         dstword = (dstword & ~dstmask) | pixel;
  1399.  
  1400.                     /* update the source */
  1401.                     srcmask >>= BITS_PER_PIXEL;
  1402.                     if (srcmask == 0)
  1403.                     {
  1404.                         srcword = (*word_read)(--swordaddr << 1);
  1405.                         srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
  1406.                     }
  1407.  
  1408.                     /* update the destination */
  1409.                     dstmask >>= BITS_PER_PIXEL;
  1410.                 }
  1411.  
  1412.                 /* write the result */
  1413.                 (*word_write)(dwordaddr << 1, dstword);
  1414.             }
  1415.  
  1416.             /* handle the left partial word */
  1417.             if (left_partials != 0)
  1418.             {
  1419.                 /* fetch the destination word */
  1420.                 dstword = (*word_read)(--dwordaddr << 1);
  1421.                 dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
  1422.  
  1423.                 /* loop over partials */
  1424.                 for (x = 0; x < left_partials; x++)
  1425.                 {
  1426.                     /* process the pixel */
  1427.                     pixel = srcword & srcmask;
  1428.                     if (dstmask > srcmask)
  1429.                         pixel <<= bitshift;
  1430.                     else
  1431.                         pixel >>= bitshift_alt;
  1432.                     PIXEL_OP(dstword, dstmask, pixel);
  1433.                     if (!TRANSPARENCY || pixel != 0)
  1434.                         dstword = (dstword & ~dstmask) | pixel;
  1435.  
  1436.                     /* update the source */
  1437.                     srcmask >>= BITS_PER_PIXEL;
  1438.                     if (srcmask == 0)
  1439.                     {
  1440.                         srcword = (*word_read)(--swordaddr << 1);
  1441.                         srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
  1442.                     }
  1443.  
  1444.                     /* update the destination */
  1445.                     dstmask >>= BITS_PER_PIXEL;
  1446.                 }
  1447.  
  1448.                 /* write the result */
  1449.                 (*word_write)(dwordaddr << 1, dstword);
  1450.             }
  1451.  
  1452.             /* update for next row */
  1453.             if (!yreverse)
  1454.             {
  1455.                 saddr += SPTCH;
  1456.                 daddr += DPTCH;
  1457.             }
  1458.             else
  1459.             {
  1460.                 saddr -= SPTCH;
  1461.                 daddr -= DPTCH;
  1462.             }
  1463.         }
  1464.     }
  1465.  
  1466.     /* eat cycles */
  1467.     if (BREG(13<<4) > tms34010_ICount)
  1468.     {
  1469.         BREG(13<<4) -= tms34010_ICount;
  1470.         tms34010_ICount = 0;
  1471.         PC -= 0x10;
  1472.     }
  1473.     else
  1474.     {
  1475.         tms34010_ICount -= BREG(13<<4);
  1476.         P_FLAG = 0;
  1477.         if (src_is_linear)
  1478.             SADDR += DYDX_Y * SPTCH + DYDX_X * BITS_PER_PIXEL;
  1479.         else
  1480.             SADDR_Y += DYDX_Y, SADDR_X += DYDX_X;
  1481.         if (dst_is_linear)
  1482.             DADDR += DYDX_Y * DPTCH + DYDX_X * BITS_PER_PIXEL;
  1483.         else
  1484.             DADDR_Y += DYDX_Y, DADDR_X += DYDX_X;
  1485.     }
  1486. }
  1487.  
  1488. #ifdef macintosh
  1489. #pragma optimization_level reset
  1490. #endif
  1491.  
  1492. static void FUNCTION_NAME(pixblt_b)(int dst_is_linear)
  1493. {
  1494.     /* if this is the first time through, perform the operation */
  1495.     if (!P_FLAG)
  1496.     {
  1497.         int dx, dy, x, y, words, left_partials, right_partials, full_words;
  1498.         mem_write_handler word_write;
  1499.         mem_read_handler word_read;
  1500.         UINT32 saddr, daddr;
  1501.  
  1502.         /* determine read/write functions */
  1503.         if (IOREG(REG_DPYCTL) & 0x0800)
  1504.         {
  1505.             word_write = shiftreg_w;
  1506.             word_read = shiftreg_r;
  1507.         }
  1508.         else
  1509.         {
  1510.             word_write = cpu_writemem29_word;
  1511.             word_read = cpu_readmem29_word;
  1512.         }
  1513.  
  1514.         /* apply the window for non-linear destinations */
  1515.         BREG(13<<4) = 4;
  1516.         if (!dst_is_linear)
  1517.             BREG(13<<4) += 2 + apply_window(1, 1);
  1518.  
  1519.         /* compute the bounds of the operation */
  1520.         dx = (INT16)DYDX_X;
  1521.         dy = (INT16)DYDX_Y;
  1522.  
  1523.         /* compute the starting addresses */
  1524.         saddr = SADDR;
  1525.         daddr = dst_is_linear ? DADDR : XYTOL(DADDR_XY);
  1526.         daddr &= ~(BITS_PER_PIXEL - 1);
  1527.  
  1528.         /* bail if we're clipped */
  1529.         if (dx <= 0 || dy <= 0)
  1530.             return;
  1531.  
  1532.         /* how many left and right partial pixels do we have? */
  1533.         left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
  1534.         right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
  1535.         full_words = dx - left_partials - right_partials;
  1536.         if (full_words < 0)
  1537.             left_partials = dx, right_partials = full_words = 0;
  1538.         else
  1539.             full_words /= PIXELS_PER_WORD;
  1540.  
  1541.         /* compute cycles */
  1542.         BREG(13<<4) += compute_pixblt_b_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING, BITS_PER_PIXEL);
  1543.         P_FLAG = 1;
  1544.  
  1545.         /* loop over rows */
  1546.         for (y = 0; y < dy; y++)
  1547.         {
  1548.             UINT16 srcword, srcmask, dstword, dstmask, pixel;
  1549.             UINT32 swordaddr, dwordaddr;
  1550.  
  1551.             /* use byte addresses each row */
  1552.             swordaddr = saddr >> 4;
  1553.             dwordaddr = daddr >> 4;
  1554.  
  1555.             /* fetch the initial source word */
  1556.             srcword = (*word_read)(swordaddr++ << 1);
  1557.             srcmask = 1 << (saddr & 15);
  1558.  
  1559.             /* handle the left partial word */
  1560.             if (left_partials != 0)
  1561.             {
  1562.                 /* fetch the destination word */
  1563.                 dstword = (*word_read)(dwordaddr << 1);
  1564.                 dstmask = PIXEL_MASK << (daddr & 15);
  1565.  
  1566.                 /* loop over partials */
  1567.                 for (x = 0; x < left_partials; x++)
  1568.                 {
  1569.                     /* process the pixel */
  1570.                     pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
  1571.                     pixel &= dstmask;
  1572.                     PIXEL_OP(dstword, dstmask, pixel);
  1573.                     if (!TRANSPARENCY || pixel != 0)
  1574.                         dstword = (dstword & ~dstmask) | pixel;
  1575.  
  1576.                     /* update the source */
  1577.                     srcmask <<= 1;
  1578.                     if (srcmask == 0)
  1579.                     {
  1580.                         srcword = (*word_read)(swordaddr++ << 1);
  1581.                         srcmask = 0x0001;
  1582.                     }
  1583.  
  1584.                     /* update the destination */
  1585.                     dstmask <<= BITS_PER_PIXEL;
  1586.                 }
  1587.  
  1588.                 /* write the result */
  1589.                 (*word_write)(dwordaddr++ << 1, dstword);
  1590.             }
  1591.  
  1592.             /* loop over full words */
  1593.             for (words = 0; words < full_words; words++)
  1594.             {
  1595.                 /* fetch the destination word (if necessary) */
  1596.                 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
  1597.                     dstword = (*word_read)(dwordaddr << 1);
  1598.                 else
  1599.                     dstword = 0;
  1600.                 dstmask = PIXEL_MASK;
  1601.  
  1602.                 /* loop over partials */
  1603.                 for (x = 0; x < PIXELS_PER_WORD; x++)
  1604.                 {
  1605.                     /* process the pixel */
  1606.                     pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
  1607.                     pixel &= dstmask;
  1608.                     PIXEL_OP(dstword, dstmask, pixel);
  1609.                     if (!TRANSPARENCY || pixel != 0)
  1610.                         dstword = (dstword & ~dstmask) | pixel;
  1611.  
  1612.                     /* update the source */
  1613.                     srcmask <<= 1;
  1614.                     if (srcmask == 0)
  1615.                     {
  1616.                         srcword = (*word_read)(swordaddr++ << 1);
  1617.                         srcmask = 0x0001;
  1618.                     }
  1619.  
  1620.                     /* update the destination */
  1621.                     dstmask <<= BITS_PER_PIXEL;
  1622.                 }
  1623.  
  1624.                 /* write the result */
  1625.                 (*word_write)(dwordaddr++ << 1, dstword);
  1626.             }
  1627.  
  1628.             /* handle the right partial word */
  1629.             if (right_partials != 0)
  1630.             {
  1631.                 /* fetch the destination word */
  1632.                 dstword = (*word_read)(dwordaddr << 1);
  1633.                 dstmask = PIXEL_MASK;
  1634.  
  1635.                 /* loop over partials */
  1636.                 for (x = 0; x < right_partials; x++)
  1637.                 {
  1638.                     /* process the pixel */
  1639.                     pixel = (srcword & srcmask) ? COLOR1 : COLOR0;
  1640.                     pixel &= dstmask;
  1641.                     PIXEL_OP(dstword, dstmask, pixel);
  1642.                     if (!TRANSPARENCY || pixel != 0)
  1643.                         dstword = (dstword & ~dstmask) | pixel;
  1644.  
  1645.                     /* update the source */
  1646.                     srcmask <<= 1;
  1647.                     if (srcmask == 0)
  1648.                     {
  1649.                         srcword = (*word_read)(swordaddr++ << 1);
  1650.                         srcmask = 0x0001;
  1651.                     }
  1652.  
  1653.                     /* update the destination */
  1654.                     dstmask <<= BITS_PER_PIXEL;
  1655.                 }
  1656.  
  1657.                 /* write the result */
  1658.                 (*word_write)(dwordaddr++ << 1, dstword);
  1659.             }
  1660.  
  1661.             /* update for next row */
  1662.             saddr += SPTCH;
  1663.             daddr += DPTCH;
  1664.         }
  1665.     }
  1666.  
  1667.     /* eat cycles */
  1668.     if (BREG(13<<4) > tms34010_ICount)
  1669.     {
  1670.         BREG(13<<4) -= tms34010_ICount;
  1671.         tms34010_ICount = 0;
  1672.         PC -= 0x10;
  1673.     }
  1674.     else
  1675.     {
  1676.         tms34010_ICount -= BREG(13<<4);
  1677.         P_FLAG = 0;
  1678.         SADDR += DYDX_Y * SPTCH + DYDX_X;
  1679.         if (dst_is_linear)
  1680.             DADDR += DYDX_Y * DPTCH + DYDX_X * BITS_PER_PIXEL;
  1681.         else
  1682.             DADDR_Y += DYDX_Y, DADDR_X += DYDX_X;
  1683.     }
  1684. }
  1685.  
  1686. static void FUNCTION_NAME(fill)(int dst_is_linear)
  1687. {
  1688.     /* if this is the first time through, perform the operation */
  1689.     if (!P_FLAG)
  1690.     {
  1691.         int dx, dy, x, y, words, left_partials, right_partials, full_words;
  1692.         mem_write_handler word_write;
  1693.         mem_read_handler word_read;
  1694.         UINT32 daddr;
  1695.  
  1696.         /* determine read/write functions */
  1697.         if (IOREG(REG_DPYCTL) & 0x0800)
  1698.         {
  1699.             word_write = shiftreg_w;
  1700.             word_read = dummy_shiftreg_r;
  1701.         }
  1702.         else
  1703.         {
  1704.             word_write = cpu_writemem29_word;
  1705.             word_read = cpu_readmem29_word;
  1706.         }
  1707.  
  1708.         /* apply the window for non-linear destinations */
  1709.         BREG(13<<4) = 4;
  1710.         if (!dst_is_linear)
  1711.             BREG(13<<4) += 2 + apply_window(0, 1);
  1712.  
  1713.         /* compute the bounds of the operation */
  1714.         dx = (INT16)DYDX_X;
  1715.         dy = (INT16)DYDX_Y;
  1716.  
  1717.         /* compute the starting addresses */
  1718.         daddr = dst_is_linear ? DADDR : XYTOL(DADDR_XY);
  1719.         daddr &= ~(BITS_PER_PIXEL - 1);
  1720.  
  1721.         /* bail if we're clipped */
  1722.         if (dx <= 0 || dy <= 0)
  1723.             return;
  1724.  
  1725.         /* how many left and right partial pixels do we have? */
  1726.         left_partials = (PIXELS_PER_WORD - ((daddr & 15) / BITS_PER_PIXEL)) & (PIXELS_PER_WORD - 1);
  1727.         right_partials = ((daddr + dx * BITS_PER_PIXEL) & 15) / BITS_PER_PIXEL;
  1728.         full_words = dx - left_partials - right_partials;
  1729.         if (full_words < 0)
  1730.             left_partials = dx, right_partials = full_words = 0;
  1731.         else
  1732.             full_words /= PIXELS_PER_WORD;
  1733.  
  1734.         /* compute cycles */
  1735.         BREG(13<<4) += compute_fill_cycles(left_partials, right_partials, full_words, dy, PIXEL_OP_TIMING);
  1736.         P_FLAG = 1;
  1737.  
  1738.         /* loop over rows */
  1739.         for (y = 0; y < dy; y++)
  1740.         {
  1741.             UINT16 dstword, dstmask, pixel;
  1742.             UINT32 dwordaddr;
  1743.  
  1744.             /* use byte addresses each row */
  1745.             dwordaddr = daddr >> 4;
  1746.  
  1747.             /* handle the left partial word */
  1748.             if (left_partials != 0)
  1749.             {
  1750.                 /* fetch the destination word */
  1751.                 dstword = (*word_read)(dwordaddr << 1);
  1752.                 dstmask = PIXEL_MASK << (daddr & 15);
  1753.  
  1754.                 /* loop over partials */
  1755.                 for (x = 0; x < left_partials; x++)
  1756.                 {
  1757.                     /* process the pixel */
  1758.                     pixel = COLOR1 & dstmask;
  1759.                     PIXEL_OP(dstword, dstmask, pixel);
  1760.                     if (!TRANSPARENCY || pixel != 0)
  1761.                         dstword = (dstword & ~dstmask) | pixel;
  1762.  
  1763.                     /* update the destination */
  1764.                     dstmask <<= BITS_PER_PIXEL;
  1765.                 }
  1766.  
  1767.                 /* write the result */
  1768.                 (*word_write)(dwordaddr++ << 1, dstword);
  1769.             }
  1770.  
  1771.             /* loop over full words */
  1772.             for (words = 0; words < full_words; words++)
  1773.             {
  1774.                 /* fetch the destination word (if necessary) */
  1775.                 if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
  1776.                     dstword = (*word_read)(dwordaddr << 1);
  1777.                 else
  1778.                     dstword = 0;
  1779.                 dstmask = PIXEL_MASK;
  1780.  
  1781.                 /* loop over partials */
  1782.                 for (x = 0; x < PIXELS_PER_WORD; x++)
  1783.                 {
  1784.                     /* process the pixel */
  1785.                     pixel = COLOR1 & dstmask;
  1786.                     PIXEL_OP(dstword, dstmask, pixel);
  1787.                     if (!TRANSPARENCY || pixel != 0)
  1788.                         dstword = (dstword & ~dstmask) | pixel;
  1789.  
  1790.                     /* update the destination */
  1791.                     dstmask <<= BITS_PER_PIXEL;
  1792.                 }
  1793.  
  1794.                 /* write the result */
  1795.                 (*word_write)(dwordaddr++ << 1, dstword);
  1796.             }
  1797.  
  1798.             /* handle the right partial word */
  1799.             if (right_partials != 0)
  1800.             {
  1801.                 /* fetch the destination word */
  1802.                 dstword = (*word_read)(dwordaddr << 1);
  1803.                 dstmask = PIXEL_MASK;
  1804.  
  1805.                 /* loop over partials */
  1806.                 for (x = 0; x < right_partials; x++)
  1807.                 {
  1808.                     /* process the pixel */
  1809.                     pixel = COLOR1 & dstmask;
  1810.                     PIXEL_OP(dstword, dstmask, pixel);
  1811.                     if (!TRANSPARENCY || pixel != 0)
  1812.                         dstword = (dstword & ~dstmask) | pixel;
  1813.  
  1814.                     /* update the destination */
  1815.                     dstmask <<= BITS_PER_PIXEL;
  1816.                 }
  1817.  
  1818.                 /* write the result */
  1819.                 (*word_write)(dwordaddr++ << 1, dstword);
  1820.             }
  1821.  
  1822.             /* update for next row */
  1823.             daddr += DPTCH;
  1824.         }
  1825.     }
  1826.  
  1827.     /* eat cycles */
  1828.     if (BREG(13<<4) > tms34010_ICount)
  1829.     {
  1830.         BREG(13<<4) -= tms34010_ICount;
  1831.         tms34010_ICount = 0;
  1832.         PC -= 0x10;
  1833.     }
  1834.     else
  1835.     {
  1836.         tms34010_ICount -= BREG(13<<4);
  1837.         P_FLAG = 0;
  1838.         if (dst_is_linear)
  1839.             DADDR += DYDX_Y * DPTCH + DYDX_X * BITS_PER_PIXEL;
  1840.         else
  1841.             DADDR_Y += DYDX_Y, DADDR_X += DYDX_X;
  1842.     }
  1843. }
  1844.  
  1845. #endif
  1846.  
  1847.